refactor: modernize type hints and enable ruff UP#12
Conversation
gregsvo
left a comment
There was a problem hiding this comment.
The `builtins.list` usage in `webhooks/manager.py` and `outbound/manager.py` is a ruff UP autofix quirk: when a class defines a method named `list`, ruff qualifies the builtin to avoid shadowing. The underlying concern is real in `webhooks/manager.py` (no `from future import annotations`, and the `list` method appears before `create`/`edit`), but the fix of choice should be `from future import annotations` rather than `builtins.list`. `outbound/manager.py` already has that import, so `builtins.list` there is dead weight.
Suggest:
- Add `from future import annotations` to `webhooks/manager.py`
- Drop `import builtins` from both files
- Use plain `list` everywhere
|
ruff does it this way so the annotations don't depend on where the list method is defined. Without builtins, any annotation using the |
This PR updates type hints to use modern python syntax for 3.10+ released in October 2021.
It can be reproduced with the following three actions:
target-version = "py310"topyproject.tomlwhich explicitly tells ruff what the minimum supported python version is.ruffruleset to include the UP rules.